using System;
using System.Collections.Generic;
using System.Text;

namespace SBPweb.Modules.Modularity
{
	/// <summary>
	/// Class of ModuleInfo
	/// </summary>
	public class ModuleInfo
	{
		#region Private members

		private ModuleDescriptor pModuleDescriptor;
		private IModule pModule;
		private bool pAutoLoad;
		private bool pAllowUnload;
		private bool pIsCoreModule;

		#endregion

		#region Constructor logic

		/// <summary>
		/// Initializes a new ModuleInfo instance
		/// </summary>
		/// <param name="md">The referenced module descriptor instance</param>
		/// <param name="autoLoad">Parameter for autoLoad</param>
		/// <param name="allowUnload">Parameter for allowUnload</param>
		/// <param name="isCoreModule">Parameter is true if module is core module</param>
		public ModuleInfo(ModuleDescriptor md, bool autoLoad, bool allowUnload, bool isCoreModule)
		{
			pModuleDescriptor = md;
			pModule = null;
			pAutoLoad = autoLoad;
			pAllowUnload = allowUnload;
			pIsCoreModule = isCoreModule;
		}

		#endregion

		#region Public properties

		/// <summary>
		/// This propterty returns the referenced module descriptor
		/// </summary>
		public ModuleDescriptor ModuleDescriptor
		{
			get
			{
				return pModuleDescriptor;
			}
		}

		/// <summary>
		/// This property returns the referenced module instance
		/// </summary>
		public IModule Module
		{
			get
			{
				return pModule;
			}
			set
			{
				pModule = value;
			}
		}

		/// <summary>
		/// This property is false if module supports post loading
		/// </summary>
		public bool AutoLoad
		{
			get
			{
				return pAutoLoad;
			}
		}

		/// <summary>
		/// This property is true if module supports runtime unloading
		/// </summary>
		public bool AllowUnload
		{
			get
			{
				return pAllowUnload;
			}
		}

		/// <summary>
		/// Returns true is module is core module
		/// </summary>
		public bool IsCoreModule
		{
			get
			{
				return pIsCoreModule;
			}
		}

		#endregion

	}
}
